/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

/**
 * 订单退款
 *  */
// eslint-disable-next-line import/no-extraneous-dependencies
import { Request, Response } from 'express';
import { responseSuccess } from '../utils';
import Mock from 'mockjs';

export default {
  'POST /regiment/OrderMonitor/lists': (req: Request, res: Response) => {
    const data = Mock.mock({
      'list|1-2': [
        {
          id: '@id',
          third_order_id: '@id()', //客户订单号
          waybill_no: '@id()', //运单号
          'brand|1': ['jd', 'sf', 'dp'], //快递品牌
          regiment_id: '@id()', //团id
          user_id: '@id()', //用户id
          shipper_name: '@cname()',
          shipper_mobile: '13783636922',
          shipper_tel: '@id()',
          shipper_province: 'xx省', //寄件人省
          shipper_city: 'xx市', //寄件人市
          shipper_county: 'xx区', //寄件人区
          shipper_address: '@cname()', //寄件人详细地址
          shipping_name: '@cname()', //收件人姓名
          shipping_mobile: '13783636922', //电话
          shipping_tel: '13783636922', //座机号
          shipping_province: 'xx省', //省
          shipping_city: 'xx市', //市
          shipping_county: 'xx区', //区
          shipping_address: '详细地址', //详细地址
          'order_status|1': ['状态1', '状态2'], //订单状态
          logistic_status: '轨迹状态', //轨迹状态
          'pay_method|1': ['支付宝', '微信'], //支付类型
          'pay_status|1': ['失败', '完成'], //支付状态
          'invoice_status|1': ['失败', '完成'], //发票状态
          is_realname: '昵称', //昵称
          // channel: '',//xxxx
          package_weight: '22', //包裹重量
          package_info: '包裹信息', //包裹信息
          package_note: '订单备注', //订单备注
          charging_weight: '22', //结算重量
          'delivery_name|1': ['产品类型1', '产品类型2'], //产品类型
          'delivery_type_name|1': ['产品类型1', '产品类型2'], //产品类型
          delivery_type: '发货状态', //发货状态
          place_volume: '下单体积', //下单体积
          settlement_volume: '结算体积', //结算体积
          collect_courier_mobile: '快递员电话', //快递员电话
          collect_courier_name: '快递员姓名', //快递员姓名
          real_collect_courier_name: '', //xxxxxx
          real_collect_courier_mobile: '', //xxxxxx
          reserve_start_time: '预约取件时间', //预约取件时间
          reserve_end_time: '预约取件时间', //预约取件时间
          collect_date: '揽收时间', //揽收时间

          sign_date: '签收时间', //签收时间
          receive_time: '接单时间', //接单时间
          create_at: '下单时间', //下单时间
          update_at: '更新时间', //更新时间
          third_create_at: '', //xxxx
          package_pics: '', //xxxx
          order_type: '', //xxxx
          cancel_reason: '取消原因', //取消原因
          pay_method_name: '付款类型', //付款类型
          order_status_name: '订单状态', //订单状态
          pay_status_name: '结算状态', //支付状态 [结算状态]
          regiment_name: '团长名称', //团长名称
          regiment_mobile: '团长电话', //团长电话
          'user_type|1': ['user', 'regiment'], //用户类型（user 用户    regiment团长）
          register_time: '注册时间', //注册时间
          packing_money: '包装费', //包装费
          freight: '运费', //运费
          wait_pay_price: '', //xxx
          other_money: '其他费用', //其他费用
          order_id: '@id()', //订单id
          f_fee: '首重金额', //首重金额
          s_fee: '续重金额', //续重金额
          regiment_estimate_price: '', //xxx
          pay_price: '团员已支付金额', //团员已支付金额
          claiming_value: '下单保价额', //下单保价额
          warrant_price: '下单保价费', //下单保价费
          real_claiming_value: '', //xxxx
          real_warrant_price: '支付保价金额', //支付保价金额
          regiment_profit: '团利润', //团利润
          admin_discount_rate: '团长折扣率', //xxxx
          user_discount_rate: '团员折扣率', //xxxx
          calculate_price_type: '计费方式', //计费方式 1 重量 2 体积
          'settlement_price_details|1': [
            '[{"fee":108,"type":1,"name":"\\u4fdd\\u4ef7\\u8d39"},{"fee":108,"type":1,"name":"\\u5305\\u88c5\\u8d39"}]',
            '',
          ], //xxxx
          pay_date: '结算时间', //支付时间[结算时间]
          original_price: '', //xxxx
          regiment_pay_price: '团长已支付金额', //团长已支付金额
          regiment_wait_pay_price: '', //xxxx
          order_number: '支付商户号', //支付商户号
          trade_number: '交易流水号', //交易流水号
          league_name: '加盟商名称',
          league_phone: '加盟商电话',
          league_profit: '加盟商利润',
          admin_s_fee: '团长续重加收费',
          user_s_fee: '团员续重加收费',
          'passage_fee|1': ['1', ''],
        },
      ],
    });
    return res.json({
      code: 0,
      data: {
        ...data,
        total: data.list.length,
      },
      msg: 'success',
    });
  },
  'POST /regiment/OrderMonitor/createExportTask': (req: Request, res: Response) =>
    responseSuccess(req, res),
  'POST /regiment/OrderMonitor/cancel': (req: Request, res: Response) => responseSuccess(req, res),
  'POST /regiment/OrderMonitor/exportTaskLists': (req: Request, res: Response) => {
    const data = Mock.mock({
      'data|1-20': [
        {
          created_at: '@date',
          status_desc: '@csentence(3)',
          file_path: '@url',
          'status|1': [2, 1],
        },
      ],
    });
    const result = {
      code: 0,
      msg: 'success',
      data,
    };
    return res.json(result);
  },
  'POST /regiment/OrderMonitor/getQueryConfig': (req: Request, res: Response) => {
    return res.send({
      code: 0,
      msg: 'success',
      data: {
        order_status: [
          '已取消',
          '待确认',
          '已下单',
          '已受理',
          '已发货',
          '运输中',
          '派件中',
          '已签收',
        ],
        brand: {
          jd: '京东',
          sf: '顺丰',
          dp: '德邦',
          ems: '邮政',
          sto: '申通',
          yd: '韵达',
          yt: '圆通',
          jt: '极兔',
          zt: '中通',
        },
        pay_method: {
          '2': '寄付月结',
          '3': '到付',
          '4': '寄付现结',
        },
        pay_status: ['待结算', '待补款', '已结清'],
        channel: {
          regiment: '全寄小程序',
          courier: '快递员/驿站',
          kop: '开放平台',
        },
      },
    });
    const result = {
      code: 0,
      msg: 'success',
      data: {
        order_status: [
          '已取消',
          '待确认',
          '已下单',
          '已受理',
          '已发货',
          '运输中',
          '派件中',
          '已签收',
        ],
        brand: {
          jd: '京东',
          sf: '顺丰',
          dp: '德邦',
        },
        pay_method: {
          '2': '寄付月结',
          '3': '到付',
          '4': '寄付现结',
        },
      },
    };
    return res.json(result);
  },
  'POST /regiment/OrderMonitor/picUpload': (req: Request, res: Response) => {
    const result = {
      code: 0,
      msg: '上传成功',
      data: '/yizhanpic/2023_07/11/164acb8ad969bf308450369.jpg',
    };
    return res.json(result);
  },
  'POST /regiment/OrderMonitor/adminCancelOrder': (req: Request, res: Response) => {
    const result = {
      code: 0,
      msg: '成功',
      data: {},
    };
    return res.json(result);
  },
};
